﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using QuanLyNhaSach.QuanLyNhaSachDao;
using QuanLyNhaSach.QuanLyNhaSachDTO;
namespace QuanLyNhaSach.QuanLyNhaSachBus
{
    class LoaiSachBus
    {
        public static bool ThemLoaiSach(LoaiSachDTO tl)
        {
            
              if(  LoaiSachDao.Insert(tl))
                return true;
            
            else
                return false;

        }
        public static bool Update(LoaiSachDTO tl)
        {

            if (LoaiSachDao.KTTen(tl.TenLoaiSach) == false && LoaiSachDao.KTTenTT(tl.TenLoaiSach) == false)
            {
                LoaiSachDao.Update(tl);
                return true;
            }

            else
                return false;

        }
        public static DataTable GetLoaiSachAll()
        {
            DataTable dt=LoaiSachDao.GetLoaiSachAll();
            return dt;

        }
        public static void Delete(LoaiSachDTO tl)
        {
           LoaiSachDao.Delete(tl);
           

        }
 
    }
}
